package space.panker916.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


// 常量似乎应该放在常量类中，而不应该放在一个接口中（虽然接口中的变量都是 public final static 的）
public final class Constants {
    public static final int ACTIVATION_SUCCESS = 0;             // 激活成功
    public static final int ACTIVATION_REPEAT = 1;              // 重复激活
    public static final int ACTIVATION_FAILURE = 2;             // 激活失败

    public static final int DEFAULT_EXPIRED_SECONDS = 3600 * 12;                // 默认状态下的登录凭证的超时时间
    public static final int REMEMBER_EXPIRED_SECONDS = 3600 * 24 * 100;         // 记住状态的登录凭证超时时间

    public static final int ENTITY_TYPE_POST = 1;                               // 实体类型：帖子
    public static final int ENTITY_TYPE_COMMENT = 2;                            // 实体类型：评论
    public static final int ENTITY_TYPE_USER = 3;                            // 实体类型：用户

    public static final String TOPIC_COMMENT = "comment";       // 主题：评论
    public static final String TOPIC_LIKE = "like";             // 主题：点赞
    public static final String TOPIC_FOLLOW = "follow";         // 主题：关注
    public static final String TOPIC_PUBLISH = "publish";       // 主题：发帖
    public static final String TOPIC_DELETE = "delete";         // 主题：删帖

    public static final int SYSTEM_USER_ID = 1;                // 系统ID

    public static final String AUTHORITY_USER = "USER";             // 权限：普通用户
    public static final String AUTHORITY_ADMIN = "ADMIN";           // 权限：管理员
    public static final String AUTHORITY_MODERATOR = "MODERATOR";   // 权限：版主

    public static final int WONDERFUL_SCORE = 75;               // 精华分数固定为 75

    // 博客初始纪元
    public static final Date EPOCH;

    static {
        try {
            EPOCH = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2022-04-28 00:00:00");
        } catch (ParseException e) {
            e.printStackTrace();
            throw new RuntimeException("初始化论坛初始时间失败");
        }
    }

}
